package org.darkforest.common.services.impl;

import org.darkforest.common.services.StoreSnsSettingService;
import org.darkforest.dao.mapper.StoreSnsSettingMapper;
import org.darkforest.model.StoreSnsSetting;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Libing on 2015/10/5.
 */
@Service
public class StoreSnsSettingServiceImpl implements StoreSnsSettingService {

    @Autowired
    private StoreSnsSettingMapper storeSnsSettingMapper;

    /**
     * 新增店铺动态设置
     *
     *
     * @param storeSnsSetting
     * @return
     */
    @Override
    public int addNew(StoreSnsSetting storeSnsSetting) {
        return storeSnsSettingMapper.insertSelective(storeSnsSetting);
    }

    /**
     * 删除
     * @param storeId
     */
    @Override
    public void delStoreSnsSetting(Integer storeId) {
        storeSnsSettingMapper.deleteByPrimaryKey(storeId);
    }

    /**
     * 获取店铺动态设置
     *
     * @return
     * @param storeId
     */
    @Override
    public StoreSnsSetting getDynamicSetting(Integer storeId) {
        return storeSnsSettingMapper.selectByPrimaryKey(storeId);
    }
}
